<?php
error_reporting(E_ALL);

include_once('Commons.php');

$period = 48; 		
$users_reported = 1;

	$rh = query("SELECT reported_id FROM reports WHERE report_date > DATE_SUB(NOW(), INTERVAL $period HOUR) GROUP BY reported_id HAVING COUNT(DISTINCT reporter_id) >= $users_reported;");


	while ($row = mysql_fetch_assoc($rh)) {

		$uid = $row['reported_id'];
		echo "deleting user: $uid<br>\n";
#		continue;

#		query("DELETE FROM profile WHERE user=$uid;");
#		query("DELETE FROM user WHERE id=$uid;");
		query("UPDATE `user` SET `banned`=1 WHERE `id`=$uid;");
		query("DELETE FROM `reports` WHERE `reported_id`=$uid;");
		query("DELETE FROM `message` WHERE `from`=$uid;");
	}


?>